/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package bean;

import entity.NewTable;
import java.security.Principal;
import javax.ejb.Stateless;
import javax.inject.Inject;
import javax.inject.Named;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author paolo
 */
@Stateless
@Named
public class Manage {
    
    private String nome;
    @PersistenceContext
    private EntityManager em;
    @Inject
    Principal principal;
    private NewTable ta;
    
            
    public Manage() {
        this.ta = new NewTable();
    }
    

    // Add business logic below. (Right-click in editor and choose
    // "Insert Code > Add Business Method")

    public Manage(String nome) {
        this.nome = nome;
        this.ta = new NewTable();
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }
    
   public void save(){
       System.out.println(nome);
       ta.setNewTablecol(nome);
       em.persist(ta);
   } 
}
